
"""
    pyprosim - a simple prolog compiler developed to PCS2056 course (Compilers) at Poli-USP\
    Copyright (C) 2008 Rodrigo Rodrigues da Silva

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
"""

import unittest

from pycoopiler.token import token
from pycoopiler.tokenizer import tokenizer
from pycoopiler.maq_chfunc import maq_chfunc
from pycoopiler.maq_cmds import maq_cmds
from pycoopiler.maq_decls import maq_decls
from pycoopiler.maq_exparith import maq_exparith
from pycoopiler.maq_explog import maq_explog
from pycoopiler.maq_largs import maq_largs
from pycoopiler.maq_program import maq_program
from pycoopiler.maq_ref import maq_ref
import logging

class testmaquinas(unittest.TestCase):
    
    tkzr = None
    
    def setUp(self):
        pass
        
    def test_maq_chfunc(self):
        self.tkzr = tokenizer(open('cases/test_mchfunc', 'r'))
        m = maq_chfunc(self.tkzr)
        m.analyze()
        m = maq_chfunc(self.tkzr)
        m.analyze()
        m = maq_chfunc(self.tkzr)
        m.analyze()
        m = maq_chfunc(self.tkzr)
        m.analyze()
        m = maq_chfunc(self.tkzr)
        m.analyze()
        m = maq_chfunc(self.tkzr)
        m.analyze()  
        m = maq_chfunc(self.tkzr)
        m.analyze()        
            
    def test_maq_cmds(self):
        self.tkzr = tokenizer(open('cases/test_mcmds', 'r'))
        m = maq_cmds(self.tkzr)
        m.analyze()     
    
    def test_maq_decls(self):
        self.tkzr = tokenizer(open('cases/test_mdecls', 'r'))
        m = maq_decls(self.tkzr)
        m.analyze()
        
    def test_maq_explog(self):
        self.tkzr = tokenizer(open('cases/test_mexplog', 'r'))  
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()     
        m = maq_explog(self.tkzr)
        m.analyze()   
        
    def test_maq_exparith(self):
        self.tkzr = tokenizer(open('cases/test_mexparith', 'r'))  
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze()   
        m = maq_exparith(self.tkzr)
        m.analyze() 
        
    def test_maq_largs(self):
        self.tkzr = tokenizer(open('cases/test_mlargs', 'r'))
        m = maq_largs(self.tkzr)
        m.analyze()
        m = maq_largs(self.tkzr)
        m.analyze()
        m = maq_largs(self.tkzr)
        m.analyze()
        m = maq_largs(self.tkzr)
        m.analyze()
        
    def test_maq_program(self):
        self.tkzr = tokenizer(open('cases/test_mprogram', 'r'))
        m = maq_program(self.tkzr)
        m.analyze()
        
    def test_maq_ref(self):
        self.tkzr = tokenizer(open('cases/test_mref', 'r'))
        m = maq_ref(self.tkzr)
        m.analyze()
        m = maq_ref(self.tkzr)
        m.analyze()
    
    def TestSuite():
        return unittest.makeSuite(testmaquinas)
    
    if __name__ == '__main__':
        unittest.main()
 
        
  